package com.guage.service.impl;

import com.guage.model.ShopVideo;
import com.guage.mapper.ShopVideoMapper;
import com.guage.service.IShopVideoService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.guage.commons.result.PageInfo;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dechao.yang
 * @since 2017-12-14
 */
@Service
public class ShopVideoServiceImpl extends ServiceImpl<ShopVideoMapper, ShopVideo> implements IShopVideoService {

     @Autowired
     private ShopVideoMapper shopVideoMapper;
	
	@Override
	public void selectDataGrid(PageInfo pageInfo) {        
        Page<ShopVideo> page = new Page<ShopVideo>(pageInfo.getNowpage(), pageInfo.getSize());        
        EntityWrapper<ShopVideo> wrapper = new EntityWrapper<ShopVideo>();
        wrapper.orderBy(pageInfo.getSort(), pageInfo.getOrder().equalsIgnoreCase("ASC"));
        selectPage(page, wrapper);        
        pageInfo.setRows(page.getRecords());
        pageInfo.setTotal(page.getTotal());
	}

	@Override
	public void insertByVo(ShopVideo shopVideoVo) {
		shopVideoMapper.insert(shopVideoVo);
	}
}
